package com.jy.datapipeline.export.service;

import com.jy.datapipeline.export.entity.ExpRuleDetailModel;
import com.jy.datapipeline.export.entity.ExpTaskModel;

import javax.sql.DataSource;
import java.math.BigInteger;
import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

public interface ExpRuleDetailService {
    public ExpRuleDetailModel findByRuleIdAndSchemaNameAndRuleTbl(String ruleId,String schemaName,String ruleTbl);
    public List<ExpRuleDetailModel> findByRuleId(String ruleId);
    public List<Map<String,Object>> findExpRuleDetailByList(String ruleId,String schemaName,String ruleTbl,
        int iDisplayStart,int iDisplayLength);

    public int findExpRuleDetailByCount(String ruleId,String schemaName,String ruleTbl);

    public ExpRuleDetailModel findByRuleDetailId(String ruleDetailId);
    public boolean updateExpRuleDetail(ExpRuleDetailModel erdm);
    public boolean save(ExpRuleDetailModel erdm);
    public boolean deleteById(int id);

    public boolean deleteByRuleId(String ruleId);

    void batchSave(List<ExpRuleDetailModel> expRuleDetailModelList) throws Exception;

    void batchDeleteById(Set<String> ruleIds) throws Exception;

    BigInteger getCount(BigInteger leftMin, BigInteger rightMax,
                        ExpRuleDetailModel expRuleDetailModel, String ruleTbl, DataSource dataSource);

    Map<String, Object> getSplitKey(ExpRuleDetailModel expRuleDetailModel, String ruleTbl,
                                    Date dataDate, DataSource dataSource) throws SQLException;

    BigInteger getTotalCount(ExpRuleDetailModel expRuleDetailModel, String ruleTbl, DataSource dataSource, Date dataDate);

    void updateExpRuleDetailIsAccurate(ExpTaskModel etm);
}
